package com.linchong.concurrency.chapter1;

/**
 * @Author:linchong
 * @CreateTime:2019-12-30 22:50
 * @Description:模板方法
 */
public class TemplateMethod {
	public final void print(String message) {
		System.out.println("**********");
		wrapPrint(message);
		System.out.println("**********");
	}

	protected void wrapPrint(String message) {

	}

	public static void main(String[] args) {
		TemplateMethod t1 = new TemplateMethod() {
			@Override
			protected void wrapPrint(String message) {
				System.out.println("==" + message + "==");
			}
		};

		TemplateMethod t2 = new TemplateMethod() {
			@Override
			protected void wrapPrint(String message) {
				System.out.println("**" + message + "**");
			}
		};
	}
}
